package com.ler.yrmall.webapp.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ler.yrmall.webapp.entity.LayoutEntity;
import com.ler.yrmall.webapp.mapper.LayoutMapper;
import com.ler.yrmall.webapp.service.LayoutService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author leron
 */
@Service
public class LayoutServiceImpl extends ServiceImpl<LayoutMapper, LayoutEntity> implements LayoutService {


    @Override
    @Transactional(rollbackFor = Exception.class)
    public void save(List<LayoutEntity> list) {
        this.remove(Wrappers.<LayoutEntity>lambdaQuery().isNotNull(LayoutEntity::getId));
        this.saveBatch(list);
    }
}